xtreme_values <- function(inpath, outpath,  para, fun) {
  
## read data
  output <- sapply(seq(inpath), function(i) {
    df <- read.table(inpath[i], header = T, sep = ",", fill = T,
                   stringsAsFactors = F)

## Min/Max day
    date <- as.character(df[["Datetime"]])
    index <- list(substr(date, 9, 10))
    
    output <- aggregate(df[[para]], by = index, FUN = fun, na.rm = T) 
    
## output
    write.table(output, outpath[i], col.names = T, row.names = F, sep = ",")
  })
}